package rank1400;

/**
 * 2946. 循环移位后的矩阵相似检查
 */
public class No2946 {
    public boolean areSimilar(int[][] mat, int k) {
        int n = mat[0].length;
        k %= n;
        if (k == 0) return true;
        for (int[] ints : mat) {
            for (int j = 0; j < n; j++) {
                if (ints[j] != ints[(j + k) % n]) return false;
            }
        }
        return true;
    }
}
